package com.school.manager.handle;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import com.school.manager.entity.ResponseEntity;
import com.school.manager.enums.ResponseEnum;
import com.school.manager.exception.BussinessException;

/**
 * description：异常统一处理
 * date：2021/2/54:34 下午
 */

@RestControllerAdvice
public class ExceptionHandle {

    @ExceptionHandler(BussinessException.class)
    public ResponseEntity handle(BussinessException exception) {
        return ResponseEnum.ERROR.failse(exception.getMessage());
    }
}
